﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using CtrLayer;
using DataLayer;

namespace ServiceLayer
{
    public class AuctionService : IAuctionService
    {
        public static AuctionCtrl aucCtr = new AuctionCtrl();
        public static ArtCtrl artCtr = new ArtCtrl();
        public static ArtistCtrl artistCtr = new ArtistCtrl();
        public static PersonCtrl personCtr = new PersonCtrl();

        public void AddArtToAuction(int aucId, int artId) 
        {
            aucCtr.AddArtToAuction(aucId, artId);
        }

        public void CreateAuction(double minPrice, double minBid, DateTime startDate, DateTime endDate, int artId, int timeInterval, int timeExtend)
        {
            aucCtr.CreateAuction(minPrice, minBid, startDate, endDate, artId, timeInterval, timeExtend);
        }

        public List<Auction> GetAllAuctions()
        {
         return aucCtr.GetAllAuctions();
        }

        public void DeleteAuction(int aucId)
        {
            aucCtr.DeleteAuction(aucId);
        }

        public void UpdateAuction(int id, double minPrice, double minBid, DateTime startDate, DateTime endDate, int timeInterval, int timeExtend)
        {
            aucCtr.UpdateAuction(id, minPrice, minBid, startDate, endDate, timeInterval, timeExtend);
        }

     
        public void CreateArtist(string name, string address, string cellphone)
        {
            artistCtr.CreateArtist(name, address, cellphone);
        }

        public void DeleteArtist(int id)
        {
            artistCtr.DeleteArtist(id);
        }

        public void UpdateArtist(int id, string name, string address, string cellphone)
        {
            artistCtr.UpdateArtist(id, name, address, cellphone);
        }

        public List<Artist> SearchArtist(int id)
        {
            return artistCtr.SearchArtist(id);
        }


        public void CreateArt(string name, string desc, int artistID, string pic, double buyprice)
        {
            artCtr.CreateArt(name, desc, artistID, pic, buyprice);
        }

        public Art SearchArt(int artNo)
        {
            return artCtr.SearchArt(artNo);
        }

        public void UpdateArt(int no, int newNo, string name, string desc, int artistID, string pic, double buyprice)
        {
            artCtr.UpdateArt(no, newNo, name, desc, artistID, pic, buyprice);
        }

        public void DeleteArt(int artNo)
        {
            artCtr.DeleteArt(artNo);
        }

        public int Login(String userName, String password)
        {
            return personCtr.Login(userName, password);
        }
    }
}
